using System.Collections.Generic;

namespace SeaVM
{
    public enum InstructionArgType
    {
        Address,
        Define,
        Data,
        Number,
        JumpNode,
    }

    public class InstructionArg
    {
        public InstructionArgType type;
        public string define;
        public string jump_node;
        public Data data;
        public int address;
        public int number;

        public InstructionArg(){}

        public InstructionArg(Data value)
        {
            data = value;
            type = InstructionArgType.Data;
        }

        public InstructionArg(int value,InstructionArgType type = InstructionArgType.Address)
        {
            this.type = type;
            if(type == InstructionArgType.Address)
            {
                address = value;
            }
            else if(type == InstructionArgType.Number)
            {
                number = value;
            }
        }

        public InstructionArg(string value,InstructionArgType type = InstructionArgType.Define)
        {
            this.type = type;
            if(type == InstructionArgType.Define)
            {
                define = value;
            }
            else if(type == InstructionArgType.JumpNode)
            {
                jump_node = value;
            }
        }
    }
    public class Instruction
    {
        public Opcode opcode;
        public List<InstructionArg> args = new List<InstructionArg>();

        public Instruction(){}
        public Instruction(Opcode opcode){
            this.opcode = opcode;
        }
    }
}